﻿<!--#include file="../../inc/common.asp" -->                         
<%   
  if trim(request("blog_id"))="" then
     if not isEmpty(userObj) then
       if not isEmpty(userObj.blog) then
         if not isEmpty(userObj.blog.blogId) then
            set blogObj = userObj.blog
         end if
       end if
     end if  
     call closeDB()
     response.redirect "?blog_id=" & blogObj.blogId
     response.end
  end if
     
  'response.write(" common cost: " & timer()-curtime  & " <br>" & vbCrLf)
  'curtime = timer()
         
  dim i, count,title_trim, user_name_trim, pageNo,display_content     
  dim blogItem, blogItems                                             
  dim  start_date_str, end_date_str, insert_time_str                  
  dim date_str, last_date_str                                         
  dim item, topItems                                                  
  dim comment, topComments                                            
  dim blogCat, blogCats                                               
  dim linkGroup, linkGroups                                           
  dim link, links, linkCount, linkIndex                               
  dim mlHost, hostedBlogs                                             
  pageNo = trim(request("pageno"))                                  
  if pageNo<>"" then                                                
    pageNo = clng(pageNo)                                             
  else                                                                
    pageNo = 1                                                        
  end if                                                              
  if pageNo<1 then                                                    
    pageNo=1                                                          
  end if                                                              
%>     
<HTML><HEAD><TITLE><%=blogObj.blogTitle%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=<%=DEFAULT_CHARSET%>">
<link rel="stylesheet" href="styles.css" type="text/css" />
<SCRIPT language="javascript">

  
  function showReply(content_id){
    window.open("reply.asp?blog_id=1&cat_id=1&pageno=&content_id="+content_id);
  }
  
  function switchDisplay(content_id){
    try{
        var content_obj = document.getElementById("content_"+content_id);
        var keywords_obj = document.getElementById("keywords_"+content_id);
        var more_obj = document.getElementById("more_"+content_id);
        var less_obj = document.getElementById("less_"+content_id);
        if (content_obj.style.display=="block"){
            content_obj.style.display="none";
            //keywords_obj.style.display="block";
            more_obj.style.display="block";
            less_obj.style.display="none";
        }else{
            content_obj.style.display="block";
            //keywords_obj.style.display="none";
            more_obj.style.display="none";
            less_obj.style.display="block";
        }
     }catch(e){   
        alert(e.description)
     }
  }
</SCRIPT>

</HEAD>
<BODY bgProperties=fixed topMargin=2 onload="">


<center>

<DIV id=container>
    <DIV id=banner>
        <h1>
        <a href="index.asp?blog_id=<%=blogObj.blogId%>"><%=blogObj.blogTitle%></a>
<% if blogCatObj.catId<>"" then %>        
          -<%=blogCatObj.CatName%>
<% end if %>
        </h1>
        <h2><%=filterHTML(blogObj.blogDesc)%></h2>

    </DIV>



    <DIV id=left>
        <div class=sidebar>
            <DIV class=photo><IMG src="<%=blogObj.photoUrl%>"  ></DIV>
            <H2>栏目分类</H2>
            <UL>
<%                                                                                                          
      blogCats = blogObj.getBlogCats()   
      if  isArray(blogCats) then         
        count = ubound(blogCats)         
        if count>0 then                  
           for i=0 to count-1            
               set blogCat = blogCats(i) 
%>
                <LI>
                <a href="index.asp?blog_id=<%=blogCat.blogId%>&cat_id=<%=blogCat.catId%>" ><%=blogCat.catName%></a>
                </LI>
<%                            
           next                  
        end if                   
      end if                     
%>
            </UL>
            <H2>最新文章</H2>  
            <UL>
<%                                                                        
        topItems = blogObj.getTopItems()                                     
        if  isArray(topItems) then                                           
          count = ubound(topItems)                                           
          if count>0 then                                                    
              for i=0 to count-1                                             
                set item = topItems(i)                                       
                if userRightObj.canReadItem(item) then                       
                    title_trim = "" & item.title                           
                    if strlen(title_trim)>23 then                               
                        title_trim = strleft(title_trim,22) & ".."            
                    end if                                                   
                    user_name_trim = "" & item.userName                    
                    if strlen(user_name_trim)>23 then                           
                        user_name_trim = strleft(user_name_trim,22) & ".."    
                    end if                                                   
%>            
              <LI>
              <a href="detail.asp?blog_id=<%=item.blogId%>&content_id=<%=item.itemId%>" ><%=title_trim%></a>
              <br>  
              -- <%=user_name_trim%><!-- at <$BlogNewItemTime$>-->
              </LI>
<%                  
                end if     
              next         
            end if         
          end if           
%>   
            </UL>

            <H2>最新回复</H2>  
            <UL>
<%                                                                             
      topComments = blogObj.getTopComments()                                      
      if  isArray(topComments) then                                               
        count = ubound(topComments)                                               
        if count>0 then                                                           
          for i=0 to count-1                                                      
              set comment = topComments(i)                                        
              if  userRightObj.canReadComment(comment) then                             
                   title_trim = "" & HTML2TXT(comment.detail)                             
                   if strlen(title_trim)>23 then                                     
                      title_trim = strleft(title_trim,22) & ".."                   
                   end if                                                         
                   user_name_trim = comment.userName                              
                   if strlen(user_name_trim)>23 then                                 
                      user_name_trim = strleft(user_name_trim,22) & ".."           
                   end if                                                         
%>            
              <LI>
              <a href="detail.asp?blog_id=<%=comment.blogId%>&content_id=<%=comment.itemId%>#comment<%=comment.commentId%>" ><%=title_trim%></a>
              <br>  
              -- <%=user_name_trim%><!-- at <%=FORMATDATETIME(comment.insertTime,vbShortTime)%>-->
              </LI>
<%                  
            end if     
          next         
        end if         
      end if           
%>   
            </UL>


            <H2>站内链接</H2>
            <UL>
<%                                                                    
   set mlHost = new MLHostClass   
   mlHost.load()                  
   hostedBlogs = mlHost.getBlogs()
   if isArray(hostedBlogs) then   
       count = ubound(hostedBlogs)
       if count>0 then            
            for i=0 to count-1    
%>
                <LI>
                <a href="index.asp?blog_id=<%=hostedBlogs(i).blogId%>"><%=hostedBlogs(i).blogTitle%></a>
                </LI>
<%                  
            next  
        end if    
    end if        
%>    
    
            </UL>
            <!--
            <H2>最新中文BLOG</H2>
            <LI>            
            <script type="text/javascript" src="http://www.cnblog.org/rings/cache/new.asp"> </script> 
            </LI>
            -->
            
<%                                                                                                                      
    linkGroups = blogObj.getLinkGroups()  
    if isArray(linkGroups) then           
        count = ubound(linkGroups)        
        if count>0 then                   
          for i=0 to count-1              
            set linkGroup = linkGroups(i) 
%>
            <H2><%=linkGroup.groupName%></H2>
            <UL>
<%                                                                                                                                                                                                      
            links = linkGroup.links                 
            if isArray(links) then                  
                linkCount = ubound(links)           
                if linkCount>0 then                 
                    for linkIndex=0 to linkCount-1  
                        set link = links(linkIndex) 
%>
            <LI>
              <a href="<%=link.linkUrl%>" title="<%=link.linkDesc%>" ><%                                                                                
                    if link.linkImg<>"" then                                       
                        response.write "<img border=0 src=" & link.linkImg &" >" 
                    else                                                             
                        response.write link.linkName                                 
                    end if                                                           
%></a>
            </LI>  
<%                         
                  next     
                end if     
            end if         
%>
            
            </UL>
<%               
           next     
         end if     
     end if         
%>
            
            <UL>

            <LI>
               <a href= target=_blank></a> 
            </LI>
            
            </UL>

        </div><!-- end of id=slidbar -->    
    </DIV><!-- end of id=left -->    



    <DIV id=center>

        <div class=tools > 
          欢迎<%=userObj.userName%><% if userObj.userName<>"" and userObj.userId="" then response.write(" [未登录]") end if %>！ 
            | <a href="index.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&lang=zh_CN">简体</a>
            | <a href="index.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&lang=zh_TW">繁體</a>
<% 
if userObj.isFound then          
  if userRightObj.canPost then %>
            | 
             <a href=edit.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%> >发表文章</a> 
<%
   end if 
   if (userObj.userId<>"") then %>
            | <a href=userinfo.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=pageNo%>>用户资料</a> 
<% end if %>
<% if (userRightObj.canManage) then %>
            | <a href=admin/basic.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=pageNo%>>控制面板</a> 
<% end if %>
            | <a href=logout.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>>退出</a>
<%
else
%>
            | <a href=register.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=pageNo%>>注册</a>
            | <a href=login.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>>登录</a>
<%
end if
%>
       </div>
            
       <DIV class=content >

<%         
  call assertConnected()                                                                       
  blogItems = blogCatObj.getBlogItems(pageNo)                                                  
  if not isArray(blogItems) then                                                               
    response.write("尚无文章")                                                               
  else                                                                                         
    count = ubound(blogItems)                                                                  
    if count<1 then                                                                            
        response.write("尚无文章")                                                           
    else                                                                                       
        for i=0 to count-1                                                                     
          set blogItem = blogItems(i)                                                          
          if not isEmpty(blogItem.itemId) then                                                 
            start_date_str = FORMATDATETIME(blogItem.startDate, vbShortDate)                   
            end_date_str = FORMATDATETIME(blogItem.endDate, vbShortDate)                       
            insert_time_str = FORMATDATETIME(blogItem.insertTime, vbShortDate)                 
            if userRightObj.canReadItem(blogItem) then                                           
%>
    
            <a name="<%=blogItem.itemId%>"></a>
            <h2> <%  if start_date_str = insert_time_str and end_date_str = insert_time_str then 
     date_str = insert_time_str                                              
 elseif  start_date_str =  end_date_str then                                 
     date_str = end_date_str                                                 
 else                                                                        
     date_str = start_date_str & " ~ " & end_date_str                        
 end if                                                                      
 'if date_str <> last_date_str then                                          
     response.write (date_str)                                               
     last_date_str = date_str                                                
 'end if                                                                     
%>  
                <% 
            if not isNull(blogItem.catId) and not isEmpty(blogItem.catId) and blogItem.catId<>"" and blogItem.catId<>"null" then 
%>[::<a href="index.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogItem.catId%>" title=查看该分类下的文章><%=blogItem.catName%></a>::]<%                      
            end if         
%>
            
            </h2>
            <h3 style="cursor:hand" onclick="switchDisplay(<%=blogItem.itemId%>)"><%=blogItem.title%></h3>
            
            <div id="excerpt_<%=blogItem.itemId%>"><%=blogItem.excerpt%></div>
            <div id="content_<%=blogItem.itemId%>" style="display:<%         
                 if blogItem.showContent=1 then            
                    display_content = true                 
                 elseif blogItem.showContent=0 then        
                    display_content = false                
                 else                                      
                    display_content = blogObj.showContent  
                 end if                                    
                 if display_content=True then              
%>block<%                 end if %><%         
                 if blogItem.showContent=1 then            
                    display_content = true                 
                 elseif blogItem.showContent=0 then        
                    display_content = false                
                 else                                      
                    display_content = blogObj.showContent  
                 end if                                    
                 if display_content<>True then             
%>none<%                 end if %>"><%  if blogItem.isSecret then                         
    response.write("<div>--保密内容--</div>")    
 end if                                            
 response.write(blogItem.detail)                   
 %><%                      
            if not isNull(blogItem.more) and not isEmpty(blogItem.more) then         
%><p><a href="detail.asp?blog_id=<%=blogObj.blogId%>&content_id=<%=blogItem.itemId%><% if blogCatObj.catId<>"" then response.write "&cat_id=" & blogCatObj.catId end if %><% if pageNo<>1 then response.write "&pageno=" & pageNo end if %>#more">阅读详细内容...</a></p><%                      
            end if    
%></div>
            <div id="more_<%=blogItem.itemId%>"  onclick="switchDisplay(<%=blogItem.itemId%>)" style="cursor:hand; display:<%         
                 if blogItem.showContent=1 then            
                    display_content = true                 
                 elseif blogItem.showContent=0 then        
                    display_content = false                
                 else                                      
                    display_content = blogObj.showContent  
                 end if                                    
                 if display_content=True then              
%>none<%                 end if %><%         
                 if blogItem.showContent=1 then            
                    display_content = true                 
                 elseif blogItem.showContent=0 then        
                    display_content = false                
                 else                                      
                    display_content = blogObj.showContent  
                 end if                                    
                 if display_content<>True then             
%>block<%                 end if %>" title="显示内容">More...</a></div>
            <div id="less_<%=blogItem.itemId%>" onclick="switchDisplay(<%=blogItem.itemId%>);document.location.href='#<%=blogItem.itemId%>';"  style="cursor:hand;display:<%         
                 if blogItem.showContent=1 then            
                    display_content = true                 
                 elseif blogItem.showContent=0 then        
                    display_content = false                
                 else                                      
                    display_content = blogObj.showContent  
                 end if                                    
                 if display_content=True then              
%>block<%                 end if %><%         
                 if blogItem.showContent=1 then            
                    display_content = true                 
                 elseif blogItem.showContent=0 then        
                    display_content = false                
                 else                                      
                    display_content = blogObj.showContent  
                 end if                                    
                 if display_content<>True then             
%>none<%                 end if %>" title="隐藏内容" >- </div>
            <div class="posted">
                <a <%if not isEmpty(blogItem.userId) then%> href="user.asp?user_id=<%=blogItem.userId%>&blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&pageno=<%=pageNo%>" <%end if%>><%=blogItem.userName%></a> <%                                                                         
  if start_date_str = insert_time_str and end_date_str = insert_time_str then 
      response.write FORMATDATETIME(blogItem.insertTime,vbLongTime)                   
  else                                                                        
      response.write blogItem.insertTime                                              
  end if                                                                      
%> 
                <% if userRightObj.canEditItem(blogItem) then %>| <a href=edit.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=blogItem.itemId%>&pageno=<%=pageNo%>> 编辑</a> <% end if  %> 
                <% if userRightObj.canDeleteItem(blogItem) then %>| <a href="#" onclick="javascript:if (confirm('确认删除吗？')){document.location.href='delete.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=blogItem.itemId%>&pageno=<%=pageNo%>';}" >删除</a> <% end if  %>
                | <a href="detail.asp?blog_id=<%=blogObj.blogId%>&content_id=<%=blogItem.itemId%><% if blogCatObj.catId<>"" then response.write "&cat_id=" & blogCatObj.catId end if %><% if pageNo<>1 then response.write "&pageno=" & pageNo end if %> ">全文链接</a>
                <% if blogItem.trackCount>0 then %>| <a href="detail.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=blogItem.itemId%>&pageno=<%=pageNo%>#trackback" >引用(<%=blogItem.trackCount%>)</a> <% end if %>
                <% if userRightObj.canReplyItem(blogItem) or blogItem.replyCount then %>| <a href="detail.asp?blog_id=<%=blogObj.blogId%>&cat_id=<%=blogCatObj.catId%>&content_id=<%=blogItem.itemId%>&pageno=<%=pageNo%>#reply" >回复(<%=blogItem.replyCount%>)</a> <% end if %>
            </div>            
            <hr >
                                                                                                           
<%                                                  
        else                                           
          'response.write "一篇隐藏文章"               
        end if ' end of if blogItem.isSecret           
        'response.flush                                 
      end if ' end of if not isEmpty(blogItem.itemId)  
    next                                               
    end if ' end of if count<1                         
  end if ' end of if not isArray(blogItems)            
%>           
        <%
  if blogCatObj.totalItemCount>0 then 
    dim link_url					   
    link_url = "index.asp?blog_id=" & blogObj.blogId 				
    if not isEmpty(blogCatObj.catId) and blogCatObj.catId<>"" then	
    	link_url = link_url & "&cat_id=" & blogCatObj.catId			
    end if																
    response.write(getPageLink(blogCatObj.totalPageCount, pageNo, blogCatObj.pageSize, blogCatObj.totalItemCount, link_url , "pageno"))
  end if    
%>                            
        
        <p align=center>
            <a href=list.asp?blog_id=<%=blogObj.blogId%> target="_blank">文章列表</a> 
            <a target="_blank" href=rss.asp?blog_id=<%=blogObj.blogId%>><img border=0 src=images/xml.gif title='RSS feed'></a>
             <a href=#top>返回页顶</a> 
        </p>
        </div><!-- end of content -->

        <p align=center>
            Powered by <A href=http://www.misslog.com title="Misslog <%=MISSLOG_VERSION%>">Misslog</a>  | Design by <a href=http://www.blueyr.com target=_blank>BlueYr</a>
        </p>

    </DIV><!-- end of id=center -->
            
           

</DIV><!-- end of id=container-->
</center>

</BODY>


</HTML>

 
<!--#include file="../../inc/end.asp" -->